def main():
    inputFileName = "/data/rkhmel01/queries_OLD/06.efficiency_topics.all"
    f1 =file(inputFileName, 'r')
    
    outputFileName1 = "/data1/team/weijiang/workspace/polyIRToolkit/polyIRIndexer/06.efficiency_topics.all.part1"
    outputFileHandlerPart1 =file(outputFileName1, 'w')
    
    outputFileName2 = "/data1/team/weijiang/workspace/polyIRToolkit/polyIRIndexer/06.efficiency_topics.all.part2"
    outputFileHandlerPart2 =file(outputFileName2, 'w')
    
    for line in f1.readlines():
        inPart1Flag = True
        for elements in line.strip().split(":")[1].split(" "):
            if elements > "snuff":
                inPart1Flag = False
        if inPart1Flag:
            outputFileHandlerPart1.write(line)
        else:
            outputFileHandlerPart2.write(line)
    
    f1.close()
    outputFileHandlerPart1.close()
    outputFileHandlerPart2.close()
    print "Done."

def aux():
    inputFileName = "/data1/team/weijiang/workspace/polyIRToolkit/polyIRIndexer/06.efficiency_topics.all.part1.head.1000"
    f1 =file(inputFileName, 'r')
    maxNumOfElements = -1
    elements = []
    queryNum = -1
    for line in f1.readlines():
        currentNumOfElements = len(line.strip().split(":")[1].split(" "))
        if maxNumOfElements < currentNumOfElements:
            queryNum = line.strip().split(":")[0]
            maxNumOfElements = currentNumOfElements
            elements = line.strip().split(":")[1].split(" ")
    print "maxNumOfElements:",maxNumOfElements
    print "elements:",elements
    print "queryNum:",queryNum
aux()